package com.xinyu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinyu.domain.Site;
import com.xinyu.mapper.SiteMapper;
import com.xinyu.service.ISiteService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author: XinYu
 * @since 2025-02-16
 */
@Service
public class SiteServiceImpl extends ServiceImpl<SiteMapper, Site> implements ISiteService {

    @Autowired
    private SiteMapper siteMapper;

    @Override
    public List<Site> findSiteByUserId(Integer userId) {
        return siteMapper.findSiteByUserId(userId);
    }

    @Override
    public IPage<Site> selectSitePage(Page<Site> page) {
        QueryWrapper<Site> wrapper = new QueryWrapper<>();
        wrapper.eq("is_delete", 0);
        return baseMapper.selectPage(page, wrapper);
    }
}
